﻿Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Imports System.Globalization
Imports System.Data.Entity

Public Class Votes
    Inherits DbContext

    Public Sub New()
        MyBase.New("VotesContext")
    End Sub

    Public Property Votes As DbSet(Of Vote)
End Class

Public Class Vote
    Public Property VoteId() As Integer
    Public Property President() As String
    Public Property VicePresident() As String
    Public Property Secretary() As String
    Public Property Treasurer() As String
    Public Property SergeantAtArms As String


End Class

Public Class MakeVote
    Public Function createVote()
        Dim position As Integer = 0
        Dim listOfVotes As New List(Of String)
        Dim newRandom As New Random
        While position < 5
            Dim RandomNumber = (newRandom.Next(1, 11)) / 10.0
            Dim RandomPerson As String = vbNullString
            If RandomNumber <= 0.2 Then
                RandomPerson = "Everett"
            ElseIf RandomNumber > 0.2 And RandomNumber <= 0.4 Then
                RandomPerson = "RebeccaGowen"
            ElseIf RandomNumber > 0.4 And RandomNumber <= 0.6 Then
                RandomPerson = "RebeccaPeek"
            ElseIf RandomNumber > 0.6 And RandomNumber <= 0.8 Then
                RandomPerson = "ChrisCamic"
            ElseIf RandomNumber > 0.8 And RandomNumber <= 1.0 Then
                RandomPerson = "Garret"
            End If
            position = position + 1
            listOfVotes.Add(RandomPerson)
        End While
        Return listOfVotes
    End Function
End Class
Public Class FindPercents
    Function findpercentages()
        Dim db As New Votes
        Dim listOfNames As New List(Of String)
        listOfNames.AddRange(New String() {"Everett", "RebeccaGowen", "RebeccaPeek", "ChrisCamic", "Garret"})
        For Each name In listOfNames
            Dim results = From Votes1 In db.Votes
                                 Where Votes1.President = name Or Votes1.VicePresident = name Or Votes1.Secretary = name Or Votes1.SergeantAtArms = name Or Votes1.Treasurer = name
                                 Select Votes1
            Dim percents As New List(Of Integer)
            Dim PresVotes, VPvotes, SecVotes, SergVotes, TreasVotes As New Integer
            For Each vote3 In results

            Next
        Next
        Return 0
    End Function
End Class

